# 冒泡排序
l=[1,2,3,4,5,9,8]
# 获得列表长度
n = len(l)
# 计算打的轮数
for i in range(1,n):
    # 计算小的轮数
    for j in range(n-i):
        if l[j]>l[j+1]:
            l[j],l[j+1] = l[j+1],l[j]
print(l)


# 选择排序
l=[1,2,3,4,5,9,8]
n=len(l)
for i in range(0,n-1):
    for j in range(i+1,n):
        if l[i]>l[j]:
            l[i],l[j]=l[j],l[i]
print(l)
